package com.cskaoyan.service;

import com.cskaoyan.bean.po.MarketUser;
import com.cskaoyan.bean.po.MarketUserExample;
import com.cskaoyan.bean.stat.*;
import com.cskaoyan.mapper.MarketUserMapper;
import com.cskaoyan.mapper.StatMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class StatServiceImpl implements StatService {

    @Autowired
    StatMapper statMapper;

    @Autowired
    MarketUserMapper marketUserMapper;

    @Override
    public StatQueryDateVo queryAll() {

        StatQueryDateVo statQueryDateVo = new StatQueryDateVo();

        List<StatQueryDateRowVo> statQueryDateRowVos = new ArrayList<>();

        String[] strings = {"day", "users"};

        statQueryDateRowVos = statMapper.queryByDay();



        statQueryDateVo.setColumns(strings);
        statQueryDateVo.setRows(statQueryDateRowVos);
        return statQueryDateVo;

    }

    @Override
    public StatQueryOrderDateVo queryOrder() {
        StatQueryOrderDateVo statQueryOrderDateVo = new StatQueryOrderDateVo();

        List<StatQueryOrderDateRowVo> statQueryOrderDateRowVos = new ArrayList<>();

        String[] s = {"day","orders","customers","amount","pcr"};

        statQueryOrderDateRowVos = statMapper.queryOrderByDay();

        statQueryOrderDateVo.setColumns(s);
        statQueryOrderDateVo.setRows(statQueryOrderDateRowVos);

        return statQueryOrderDateVo;
    }

    @Override
    public StatQueryGoodsDateVo queryGoods() {
        StatQueryGoodsDateVo statQueryGoodsDateVo = new StatQueryGoodsDateVo();

        List<StatQueryGoodsDateRowVo> statQueryGoodsDateRowVos = new ArrayList<>();

        String[] s = {"day","orders","products","amount"};

        statQueryGoodsDateRowVos = statMapper.queryGoodsByDay();

        statQueryGoodsDateVo.setColumns(s);
        statQueryGoodsDateVo.setRows(statQueryGoodsDateRowVos);

        return statQueryGoodsDateVo;
    }
}
